import {ErrorCode} from "./ErrorCode";
import {Pos} from "../utils/Pos";
import Tokenizer from "../tokenizer/Tokenizer";
import {TokenType} from "../tokenizer/TokenType";
import {Token} from "../tokenizer/Token";


export default class ExpectedTokenError extends Error {

    private expectTokenType: TokenType;
    private token: Token;

    constructor(expectedTokenType: TokenType, token: Token) {
        super();
        this.expectTokenType = expectedTokenType;
        this.token = token;
    }

    toString(): string {
        return `Analyse error. Expected ${this.expectTokenType} at ${this.token.startPos}got: ${this.token.toString()}`;
    }
}